home *** CD-ROM | disk | FTP | other *** search
/ Netware Super Library / Netware Super Library.iso / note_tip / tsrbug / tsrbug.txt
Text File  |  1990-05-24  |  5KB  |  114 lines

  1. I have run into what appears to be a bug in NetWare 2.15.  This
  2. has been reported to me by others, but I personally experienced
  3. it on a PS/2 Model 70 running DOS 3.3.  Can you confirm this as
  4. a bug, and can you suggest a workaround?
  5.  
  6. Here is the simplest way I found to exhibit the problem:  On a
  7. Novell client station, you first run the program listed below.
  8. What the program does is this:  It intercepts the INT 21 vector
  9. and then it TSRs.  Thereafter all INT 21s pass through this program.
  10. The INT 21 interception is extremely benign, and should not adversely
  11. affect normal DOS operation.  It calls the standard INT 21 service,
  12. and then checks whether the function just completed was DOS function 3D
  13. (to open an existing file).  If it was not 3D, then control is returned
  14. to the caller.  If the call was a 3D, then, prior to returning to the
  15. caller, we do a DOS function 19 (which merely returns the current
  16. default disk drive), and then return to the caller.  The registers
  17. are properly preserved across the function 19, so there should be no
  18. adverse effect from this extra DOS call.
  19.  
  20. The above-described program runs without incident under a normal
  21. DOS environment.  However, when you run it on the Novell client
  22. (running it after all NetWare is installed, of course), and then
  23. use the DOS "TYPE" command to type a file which is located on a
  24. drive on a remote server, the resulting display will show a perpetual
  25. stream of junk.  Note that this problem DOESN'T happen when you type
  26. a file from a local disk, only when you type a remote file.
  27.  
  28. I examined this with my debugger to determine as precisely as I
  29. could what was happening.  The TYPE command opens the file to be
  30. typed with a DOS function 3D.  The TSR intercepts that and follows
  31. it with a function 19.  Then the TYPE command continues by attempting
  32. to read the data from the file with a DOS function 3F.  It is the
  33. function 3F that actually screws up:  It returns an incorrect byte
  34. count (in my case it returned a byte count of 6, even though the file
  35. size was something like 200), and it doesn't properly fill the buffer.
  36. The TYPE command repeats the function 3F as it attempts to read the
  37. entire file, but EOF is never reached.  Every subsequent call to 3F
  38. returns the same byte count and the same buffer.  So TYPE continues
  39. to fill the screen with the same junk, ad infinitum.
  40.  
  41. Unfortunately, the problem is not so simple as a DOS function 3F
  42. failing following a 3D and a 19.  That sequence seems to work OK in
  43. a simple test program.  Something specific about the TYPE situation
  44. causes this problem to manifest.
  45.  
  46. You can see the program below, and confirm that there is nothing
  47. about this simple program that should interfere with the integrity
  48. of the operating system.
  49.  
  50. -- David Rolfe
  51.  
  52. Below is the source of TEST.ASM.  To generate a .COM file:
  53.  
  54. MASM test;
  55. LINK test;
  56. EXE2BIN test.exe test.com
  57.  
  58. cseg    SEGMENT
  59.  
  60. ASSUME cs:cseg,ds:cseg
  61.  
  62. ORG     100h
  63.  
  64. Start:  mov     ax,3521h                ;Read current INT 21 vector
  65.         int     21h
  66.         mov     WORD PTR OldINT21[0],bx ;Store for later
  67.         mov     WORD PTR OldINT21[2],es ; ..
  68.  
  69.         mov     ax,2521h                ;Steal INT 21 vector
  70.         mov     dx,OFFSET MyINT21
  71.         int     21h
  72.  
  73.         mov     ax,3100h                ;Terminate and stay resident
  74.         mov     dx,OFFSET Last+15
  75.         shr     dx,1
  76.         shr     dx,1
  77.         shr     dx,1
  78.         shr     dx,1
  79.         int     21h
  80.  
  81.  
  82. ASSUME  cs:CSEG,ds:nothing,es:nothing,ss:nothing
  83.  
  84. OldINT21        DD      ?       ;Original INT 21 vector stored here
  85. DOSfnc          DB      ?       ;Local temp storage of INT 21 function
  86.  
  87. MyINT21 PROC    FAR
  88.  
  89.         mov     DOSfnc,ah       ;Store requested INT 21 function
  90.  
  91.         pushf                   ;Call standard INT 21 service
  92.         call    OldINT21
  93.         jc      MyInt2          ;If INT 21 failed, we do nothing
  94.         pushf                   ;Preserve flags returned by INT 21
  95.         cmp     DOSfnc,3Dh      ;If wasn't INT 21 function 3Dh, do nothing
  96.         jne     MyInt1          ; ..
  97.  
  98.         push    ax              ;Preserve ax returned by funcion 3Dh
  99.         mov     ah,19h          ;Do DOS function 19h
  100.         cli
  101.         pushf
  102.         call    OldINT21
  103.         pop     ax              ;Restore ax destroyed by function 19h
  104.  
  105. MyInt1: popf                    ;Restore flags
  106. MyInt2: ret     2               ;Return to caller
  107.  
  108. MyINT21 ENDP
  109.  
  110. Last    LABEL   BYTE
  111.  
  112. cseg    ENDS
  113. END     Start
  114.